from api_test.api.calendar.calendar_api import CalendarApi
from api_test.testcases.base_feishu_testcase import BaseFeiShuTestCase


class BaseCalendarTestCase(BaseFeiShuTestCase):
    def setup_class(self, ):
        self.calendarapi = CalendarApi()

    def teardown_class(self):
        print(f"\nteardown {self.calendarapi.calendar_ids}")
        if self.calendarapi.calendar_ids:
            for calendar_id in self.calendarapi.calendar_ids:
                res = self.calendarapi.delete(calendar_id)
                # print(res)
                if res.get('code') != 0:
                    if res.get('code') != 191003:
                        print(f"\n{calendar_id} 删除失败 {res}")
                        return f"\n{calendar_id} 删除失败 {res}"
        print("\n数据后置OK! ")